//
//  PaiLie5VC.m
//  K8彩票
//
//  Created by zyn on 2017/6/8.
//  Copyright © 2017年 zhoubo. All rights reserved.
//

#import "PaiLie5VC.h"
#import "BallButton.h"

@interface PaiLie5VC ()<OnClickBallCallback>
@property (weak, nonatomic) IBOutlet UIView *view1;
@property (weak, nonatomic) IBOutlet UIView *view2;
@property (weak, nonatomic) IBOutlet UIView *view3;
@property (weak, nonatomic) IBOutlet UIView *view4;
@property (weak, nonatomic) IBOutlet UIView *view5;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *layoutView1Height;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *layoutView2Height;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *layoutView3Height;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *layoutView4Height;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *layoutView5Height;

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *layoutContainerHeight;
@property (weak, nonatomic) IBOutlet UIButton *btnApply;
@end

@implementation PaiLie5VC

- (void)viewDidLoad {
    [super viewDidLoad];
    [self initializeView];
    [self initializeData];
}

-(void)initializeView{
    _btnApply.layer.cornerRadius = 4;
    ((ViewController *)[UIApplication sharedApplication].keyWindow.rootViewController).mainTabbar.frame = CGRectMake(0, -49, 0, 0);
    
    _layoutView1Height.constant = (ScreenWidth()  -  40 - 48 - 6 * 12) / 5 * 2 + 12 * 3;
    _layoutView2Height.constant = (ScreenWidth()  -  40 - 48 - 6 * 12) / 5 * 2 + 12 * 3;
    _layoutView3Height.constant = (ScreenWidth()  -  40 - 48 - 6 * 12) / 5 * 2 + 12 * 3;
    _layoutView4Height.constant = (ScreenWidth()  -  40 - 48 - 6 * 12) / 5 * 2 + 12 * 3;
    _layoutView5Height.constant = (ScreenWidth()  -  40 - 48 - 6 * 12) / 5 * 2 + 12 * 3;
    
    _layoutContainerHeight.constant = ((ScreenWidth()  -  40 - 48 - 6 * 12) / 5 * 2 + 12 * 3) * 5 + 50;

}

-(void)initializeData{
    for (int i = 1; i < 11; i ++) {
        BallButton *btn1 = [[BallButton alloc]initWithNumber:i superView:_view1];
        BallButton *btn2 = [[BallButton alloc]initWithNumber:i superView:_view2];
        BallButton *btn3 = [[BallButton alloc]initWithNumber:i superView:_view3];
        BallButton *btn4 = [[BallButton alloc]initWithNumber:i superView:_view4];
        BallButton *btn5 = [[BallButton alloc]initWithNumber:i superView:_view5];

        btn1.callback = self;
        btn2.callback = self;
        btn3.callback = self;
        btn4.callback = self;
        btn5.callback = self;
    }
    
}
- (IBAction)onClickBack:(id)sender {
    [self  back];
    
//    ((ViewController *)[UIApplication sharedApplication].keyWindow.rootViewController).mainTabbar.hidden = NO;
//    ((ViewController *)[UIApplication sharedApplication].keyWindow.rootViewController).mainTabbar.frame = CGRectMake(0, [UIScreen mainScreen].bounds.size.height-49 , 0, 49);
    
//    [self dismissViewControllerAnimated:YES completion:nil];
}
- (IBAction)onClickApply:(id)sender {
    if (IS_OPEN_SWITCH) {
        [self showHint:@"投注成功"];
        
    }
    else
    {
        [self showHint:@"请开启虚拟投注功能"];
    }
}

-(void)onClickBall{
    
}


@end
